﻿Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.OleDb

Public Class AnalisisADO
    Dim MiConexion As New ConexionADO
    Dim cmd As New SqlCommand

    Public Function ListarAnalisis(ByVal p_Codanl As String) As DataTable
        Try
            Dim cn As New SqlConnection(MiConexion.GetCnx)
            Using cn
                Dim cmd As New SqlCommand("sp_Lista_Analisis", cn)
                Using cmd
                    cmd.CommandType = Data.CommandType.StoredProcedure
                    cmd.Parameters.Add("@p_Codanl", SqlDbType.Char, 7)
                    cmd.Parameters("@p_Codanl").Value = IIf(p_Codanl Is String.Empty, Nothing, p_Codanl.Trim)
                    Dim da As SqlDataAdapter = New SqlDataAdapter(cmd)
                    Dim dt As DataTable = New DataTable("Analisis")
                    da.Fill(dt)
                    Return dt
                End Using
            End Using
        Catch myException As Exception
            MsgBox("AnalisisADO (ListarAnalisis) --> " & myException.Message, MsgBoxStyle.Critical)
            Return Nothing
        End Try
    End Function
End Class
